   function f= RoyParams2b(PARAMS,OBS);
   
    fr        =    OBS(1);
    m_y_r     =    OBS(2);
    m_y_n     =    OBS(3);
    s_y_r     =    OBS(4);
    s_y_n     =    OBS(5);
  
    mu_r    =  PARAMS(1);
    mu_n    =  PARAMS(2);
    s_rr    =  PARAMS(3);  %% these lines treat the params as variances and covariances
    s_nn    =  PARAMS(4);
    S_rn    =  PARAMS(5);
    S_rr    =  s_rr^2;
    S_nn    =  s_nn^2;
    

   %-- Implied Objects

    S_star  =  S_nn + S_rr -2*S_rn;
    s_star  =  (S_star)^.5;
    c_r     =  (mu_r-mu_n)/s_star;
    c_n     =  -c_r;
    rho_r   = (S_rr - S_rn)/(s_star*S_rr^.5);
    rho_n   = (S_nn - S_rn)/(s_star*S_nn^.5);
    lamb_r  = normpdf(c_r)/normcdf(c_r);
    lamb_n  = normpdf(c_n)/normcdf(c_n);
    
%% Implied Observations from Inputs
    i_fr        =    normcdf(c_r);
    i_m_y_r     =    mu_r + (S_rr-S_rn)/s_star*lamb_r;
    i_m_y_n     =    mu_n + (S_nn-S_rn)/s_star*lamb_n;
    i_s_y_r     =  ( S_rr*(rho_r^2*( 1 - c_r*lamb_r - lamb_r^2 ) + 1 - rho_r^2 ) )^.5; 
    i_s_y_n     =  ( S_nn*(rho_n^2*( 1 - c_n*lamb_n - lamb_n^2 ) + 1 - rho_n^2 ) )^.5;
    
    
%% Distance (Euclidean)
f  =  (i_fr-fr)^2+(i_m_y_r-m_y_r)^2 +(i_m_y_n-m_y_n)^2 +(i_s_y_r-s_y_r)^2 +(i_s_y_n-s_y_n)^2;
